export default {
  namespaced: true,
  state: {
    list: [
      {id: '001', title: '这是第一条新闻'},
      {id: '002', title: '这是第2条新闻'},
      {id: '003', title: '这是第3条新闻'},
      {id: '004', title: '这是第4条新闻'},
      {id: '005', title: '这是第5条新闻'}
    ],
    current: {},
  },
  actions: {
    getCurrent(context, id) {
      id && context.commit('saveCurrent', id)
    }
  },
  mutations: {
    saveCurrent(state, id) {
      const findOne = state.list.find(item => item.id === id);
      state.current = findOne;
    }
  },
  getters: {}
}